package com.woniu.controller;

import com.woniu.entity.ProcurePlan;
import com.woniu.service.ProcurePlanService;
import com.woniu.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/procurePlan")
public class ProcurePlanController {

    @Resource
    private ProcurePlanService procurePlanService;

    // 查全部
    @GetMapping
    public ResponseUtil findAll() {
        return procurePlanService.findAll();
    }

    // 根据 procureId 查
    @GetMapping("/{procureId}")
    public ResponseUtil findByProcureId(@PathVariable String procureId) {
        return procurePlanService.findByProcureId(procureId);
    }

    // 新增
    @PostMapping
    public ResponseUtil add(@RequestBody ProcurePlan procurePlan) {
        return procurePlanService.add(procurePlan);
    }

    // 删除
    @DeleteMapping("/{procureId}")
    public ResponseUtil delete(@PathVariable String procureId) {
        return procurePlanService.delete(procureId);
    }

    // 修改
    @PutMapping
    public ResponseUtil update(@RequestBody ProcurePlan procurePlan) {
        return procurePlanService.update(procurePlan);
    }

    @GetMapping("/stu")
    public ResponseUtil findByStatus() {
        return procurePlanService.findByStatus();
    }

    // 多条件查询
    @GetMapping("/condition")
    public ResponseUtil findByCondition(ProcurePlan procurePlan) {
        return procurePlanService.findByCondition(procurePlan);
    }


}